home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / c / AFramev01.lha / AFramev01 / Include / serial.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  2.7 KB  |  88 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Serial.hpp
  3. //
  4. // Deryk B Robosson
  5. // Jeffry A Worth
  6. // December 16, 1995
  7. //////////////////////////////////////////////////////////////////////////////
  8.  
  9. #ifndef __AFSERIAL_HPP__
  10. #define __AFSERIAL_HPP__
  11.  
  12. //////////////////////////////////////////////////////////////////////////////
  13. // INCLUDES
  14. #include "AFrame:include/aframe.hpp"
  15. #include <exec/types.h>
  16. #include <devices/serial.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19.  
  20. #define NONE  0
  21. #define EVEN  1
  22. #define ODD   2
  23. #define MARK  3
  24. #define SPACE 4
  25. #define OFF   0
  26. #define RTSCTS 1
  27. #define IOB_SER ((struct IOExtSer *)(iob))
  28.  
  29. //////////////////////////////////////////////////////////////////////////////
  30. // Serial Class
  31.  
  32. class AFSerial : public AFObject
  33. {
  34. public:
  35.   AFSerial();
  36.   ~AFSerial();
  37.  
  38.   virtual void DestroyObject();
  39.   virtual char *ObjectType() { return "AFSerial"; };
  40.  
  41. // Methods
  42.     virtual void Create(char *,int,ULONG,int,int,int,int,int,int);
  43.     virtual void Close();
  44.     virtual void SetParameters();
  45.     int Status();
  46.  
  47. //  virtual void DoIO(struct IORequest *iob_ptr);
  48. //  virtual void SetBaud(int baudrate);
  49. //  virtual void SetBits(int databits);
  50. //  virtual void SetStop(int stopbits);
  51. //  virtual void SetParity(int parity);
  52. //  virtual void SetHand(int shake);
  53. //  virtual void SetHighSpeed(int true_or_false);
  54. //  virtual void SetShare(int true_or_false);
  55. //  virtual void SetParams(void);
  56. //  virtual void WriteData(UBYTE *, int numbytes);
  57. //  virtual void Write(UBYTE *, char termchar='\0');
  58. //  virtual void WriteByte(UBYTE);
  59.  
  60. //  UBYTE ReadByte();
  61. //  UBYTE *Read(int numbytes);
  62. //  UBYTE *Read(char termchar='\r');
  63.  
  64. private:
  65.  
  66.     LPMsgPort m_SerialMP;       // used for reads/writes normal and reads highspeed
  67.     LPMsgPort m_SerialHSMP;     // message port used for writes with highspeed set
  68.     LPIORequest m_SerIO;
  69.     LPIORequest m_SerHSIO;
  70.     LPIOExtSer m_SerialIO;      // ExtendedIORequest reads/writes
  71.     LPIOExtSer m_SerialHSIO;    // used with highspeed set
  72.  
  73.     int isopen;         // keeps track of open/close of device
  74.  
  75.     char *m_devicename; // serial device name
  76.     int m_unit;         // device unit number
  77.     ULONG m_baud;       // range 1 to 4,294,967,295 =)
  78.     int m_bits;         // Read/Write length typically 7 or 8
  79.     int m_stopbit;      // typically 1 or 2
  80.     int m_parity;       // parity for device
  81.     int m_handshake;    // software (xon/xoff) or hardware(RTS/CTS)
  82.     int m_highspeed;    // sets highspeed mode (read & write) TRUE/FALSE
  83.     int m_share;        // opens device in shared mode TRUE/FALSE
  84. };
  85.  
  86. //////////////////////////////////////////////////////////////////////////////
  87. #endif // __AFSERIAL_HPP__
  88.